<template>
  <l-data-panel v-if="data._isInit" :label="config.title">
    <l-echarts ref="main"></l-echarts>
  </l-data-panel>
</template>
<script>
import mixin from "../chart";
export default {
  mixins: [mixin()],
  data() {
    return {
      option: {
        tooltip: {
          formatter: "{a}: {c}",
        },
        series: [
          {
            name: "",
            type: "gauge",
            detail: {
              formatter: "{value}",
            },
            data: [],
          },
        ],
      },
    };
  },
  methods: {
    getOption() {
      const {valueKey,title } = this.config;
      this.option.series[0].name = title
      // 数据配置
      const data = this.showData || [];
      if (valueKey && data.length > 0) {
        this.option.series[0].data = [{
          value: data[0][valueKey]
        }];
      }
      return this.option;
    },
  },
};
</script>

